<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:th="http://www.thymeleaf.org"
	xmlns:winter="http://www.winter.org"
	xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
	layout:decorator="/layouts/layout">
	
	<div id="DocumentoGestionFragment" th:fragment="DocumentoGestionFragment">
		<winter:output id="mainDocumentoDialogOutput" class="winter-form form-container">
			<winter:output id="formDocumentoDialogOutput" class="cabecera">
				<winter:row>
					<winter:column type="col-md-4">
						<winter:select id="selectTipoDocumento"
							field="*{documento.idtipodocumento}"
							collection="tiposDom, rowTiposDom : ${personas.tiposDoc}"
							value="@{${tiposDom.id}}" 
							text="@{${tiposDom.descripcion}}"
							label="#{label.persona.documento.tipo}"
							required="true"
							requiredmessage="#{label.persona.documento.tipo.requerido}"
							modern="true"
							showglobalmessage="true">
						</winter:select>
						<winter:event id="EventDocumento" event="change"
							target="selectTipoDocumento"
							url="@{'/personas/tipoDocumentoEvent'}" form="PersonasForm"
							update="nroDocOutput" object="personas" immediate="true"
							showstatus="true" showstatuselement="true">
						</winter:event>
					</winter:column>
					<winter:column type="col-md-4">
						<winter:output id="nroDocOutput" class="row padded">
							<winter:inputtext id="NuevoPersonaNumeroDoc"
								field="*{documento.nrodocumento}"
								label="#{label.persona.documento.numero}" 
								labeldisplay="col-xs-3"
								inputdisplay="col-xs-6"
								removecontainer="true"
								class="winter-input-text capitalize"
								required="true"
								requiredimage="/images/icons/exclamation-small-red.png"
								requiredmessage="#{label.persona.documento.numero.requerido}"
								maxlength="50"
								maxlengthmessage="Favor ingrese hasta 50 digitos"
								type="float">
							</winter:inputtext>
							<winter:inputtext id="NuevoPersonaDvDoc"
								field="*{documento.dvdocumento}" 
								if="${personas.ruc}"
								inputdisplay="col-xs-2"
								removecontainer="true"
								class="winter-input-text capitalize input-dv"
								type="float"
								maxlength="1"
								maxlengthmessage="Favor ingrese hasta 1 digitos">
							</winter:inputtext>
						</winter:output>
					</winter:column>
				</winter:row>
				<winter:row>
					<winter:column type="col-md-4">
						<winter:select id="selectPaisDoc" 
							field="*{documento.pais}"
							collection="paisDoc, rowPaisDoc : ${personas.paises}" 
							value="${paisDoc.id}"
							text="@{${paisDoc.descripcion}}"
							label="#{label.persona.documento.pais}" 
							required="true"
							requiredmessage="#{label.persona.pais.documento.requerido}" 
							modern="true"
							showglobalmessage="true">
						</winter:select>
					</winter:column>
					<winter:column type="col-md-4">
						<winter:datetimepicker
							id="nuevoPersonaDocVencimiento"
							label="#{label.persona.documento.vencimiento}"
							field="*{documento.vencimiento}" 
							format="DD/MM/YYYY">
						</winter:datetimepicker>
					</winter:column>
					<winter:column type="col-md-4">
						<winter:check id="nuevoPersonaDocPrincipal" 
							field="*{documento.isprincipal}"
							label="#{label.persona.documento.isPrincipal}"
							labeldisplay="col-xs-4"
							inputdisplay="col-xs-8">
						</winter:check>
					</winter:column>
					<winter:column type="col-md-4">
						<winter:check id="nuevoPersonaDocActivo" 
							field="*{documento.activo}"
							label="#{label.common.activo}"
							labeldisplay="col-xs-4"
							inputdisplay="col-xs-8">
						</winter:check>
					</winter:column>
				</winter:row>
				<winter:row class="button-panel-right" padded="true">
					<winter:ajaxSubmit id="CrearDocumento" 
						form="PersonasForm"
						url="@{'/personas/guardarDocumento'}"
						update="DocumentosInclude"
						object="personas" 
						value="#{label.operaciones.guardar}" 
						showstatus="true"
						class="btn btn-cyan" 
						process="DocumentoCrearContainer"
						oncomplete="@{'Winter.ui.CloseDialog(\'DocumentoDialog\')'}">
					</winter:ajaxSubmit>
					<winter:ajaxSubmit id="CrearDocumentoCancelar"
						form="PersonasForm" 
						object="personas"
						url="@{'/personas/cancelar/DOCUMENTO'}"
						update="DialogOutput, CrearEditarPersonaOutput"
						value="#{label.operaciones.cancelar}" 
						showstatus="true"
						class="btn btn-danger" 
						process="DocumentoCrearContainer"
						immediate="true"
						oncomplete="@{'Winter.ui.CloseDialog(\'DocumentoDialog\')'}">
					</winter:ajaxSubmit>
				</winter:row>
		    </winter:output>
		</winter:output>
	</div>
</html>